﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace MyControls
{
    public partial class THMeter : UserControl
    {
        public THMeter()
        {
            InitializeComponent();
        }

        //设置温湿度柱状显示和实际温湿度显示【属性】
        private int barHight = 135;

        public double SerHTValue
        {
            set
            {
                if (value < 0 || value > 70)
                {
                    MessageBox.Show("温湿度值必须在0-70之间！", "信息提示");
                }
                else
                {
                    double realValue = (barHight / 70.0) * value; //实际值对应的高度
                    //上面空白部分的遮罩高度
                    this.lblBar.Height = barHight - (int)realValue;
                }
            }
        }

    }
}
